/**
 * 将一个类链表结构的对象转为真正的链表
 */
import LinkedList from "../../helper/LinkedList";
export default (obj) => {
    let result = {};
    //第一层循环是拿每个页面
    for (let page in obj) {
        if (page === "config") {
            result[page] = obj[page];
            continue;
        };
        //第二层循环是拿每个页面的header、main、footer
        for (let part in obj[page]) {
            // if (part === "config") continue;
            if (!result[page]) {
                result[page] = {};
            }
            if (part === "config") {
                result[page].config = obj[page].config;
                continue;
            }
            
            let partLinkList = obj[page][part];
            let list = new LinkedList();
            let current = partLinkList.head;
            while (current) {
                list.push(current.element);
                current = current.next;
            }
            if (part === "content") {
                result[page].main = list;
            } else {
                result[page][part] = list;
            }
            
        }
    }
    console.log("解析链表", result);
    return result;
}